package cn.wolfcode.qo;

import cn.hutool.core.date.DateUtil;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Getter
@Setter
@ToString
public class NoticeQueryObject extends QueryObject{
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date startDate;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date endDate;

    private Integer queryLevel;

    private Boolean queryReadStatus;

    //覆盖get方法
    public Date getEndDate(){
        //使用Hutool工具类,设置时分秒为23:59:59
        if(endDate == null){
            return null;
        }
        return DateUtil.endOfDay(endDate);
    }
}
